/***************************************************************
 * Name:      CMI_Lab_de_RedesMain.cpp
 * Purpose:   Code for Application Frame
 * Author:    Daniel Calvo Marín, Jeffry Araya Castrillo ()
 * Created:   2011-06-25
 * Copyright: Daniel Calvo Marín, Jeffry Araya Castrillo ()
 * License:
 **************************************************************/

#include "CMI_Lab_de_RedesMain.h"
#include <wx/msgdlg.h>

//(*InternalHeaders(CMI_Lab_de_RedesFrame)
#include <wx/intl.h>
#include <wx/string.h>
//*)

//helper functions
enum wxbuildinfoformat {
    short_f, long_f };

wxString wxbuildinfo(wxbuildinfoformat format)
{
    wxString wxbuild(wxVERSION_STRING);

    if (format == long_f )
    {
#if defined(__WXMSW__)
        wxbuild << _T("-Windows");
#elif defined(__UNIX__)
        wxbuild << _T("-Linux");
#endif

#if wxUSE_UNICODE
        wxbuild << _T("-Unicode build");
#else
        wxbuild << _T("-ANSI build");
#endif // wxUSE_UNICODE
    }

    return wxbuild;
}

//(*IdInit(CMI_Lab_de_RedesFrame)
const long CMI_Lab_de_RedesFrame::ID_TEXTCTRL1 = wxNewId();
const long CMI_Lab_de_RedesFrame::ID_LISTBOX1 = wxNewId();
const long CMI_Lab_de_RedesFrame::ID_BUTTON1 = wxNewId();
const long CMI_Lab_de_RedesFrame::ID_BUTTON2 = wxNewId();
const long CMI_Lab_de_RedesFrame::ID_NOTEBOOK1 = wxNewId();
const long CMI_Lab_de_RedesFrame::ID_PANEL1 = wxNewId();
//*)

BEGIN_EVENT_TABLE(CMI_Lab_de_RedesFrame,wxFrame)
    //(*EventTable(CMI_Lab_de_RedesFrame)
    //*)
END_EVENT_TABLE()

CMI_Lab_de_RedesFrame::CMI_Lab_de_RedesFrame(wxWindow* parent,wxWindowID id)
{
    //(*Initialize(CMI_Lab_de_RedesFrame)
    Create(parent, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, wxDEFAULT_FRAME_STYLE, _T("wxID_ANY"));
    SetClientSize(wxSize(686,635));
    Panel1 = new wxPanel(this, ID_PANEL1, wxPoint(120,224), wxSize(656,616), wxTAB_TRAVERSAL, _T("ID_PANEL1"));
    TextCtrl1 = new wxTextCtrl(Panel1, ID_TEXTCTRL1, wxEmptyString, wxPoint(56,488), wxSize(336,88), wxTE_MULTILINE|wxTE_WORDWRAP, wxDefaultValidator, _T("ID_TEXTCTRL1"));
    ListBox1 = new wxListBox(Panel1, ID_LISTBOX1, wxPoint(416,72), wxSize(224,504), 0, 0, 0, wxDefaultValidator, _T("ID_LISTBOX1"));
    Button1 = new wxButton(Panel1, ID_BUTTON1, _("Enviar"), wxPoint(96,592), wxDefaultSize, 0, wxDefaultValidator, _T("ID_BUTTON1"));
    Button2 = new wxButton(Panel1, ID_BUTTON2, _("Enviar Broadcast"), wxPoint(200,592), wxDefaultSize, 0, wxDefaultValidator, _T("ID_BUTTON2"));
    Notebook1 = new wxNotebook(Panel1, ID_NOTEBOOK1, wxPoint(56,80), wxSize(336,400), 0, _T("ID_NOTEBOOK1"));
    
    Connect(ID_LISTBOX1,wxEVT_COMMAND_LISTBOX_SELECTED,(wxObjectEventFunction)&CMI_Lab_de_RedesFrame::OnListBox1Select);
    Connect(ID_BUTTON1,wxEVT_COMMAND_BUTTON_CLICKED,(wxObjectEventFunction)&CMI_Lab_de_RedesFrame::OnButton1Click);
    Connect(ID_NOTEBOOK1,wxEVT_COMMAND_NOTEBOOK_PAGE_CHANGED,(wxObjectEventFunction)&CMI_Lab_de_RedesFrame::OnNotebook1PageChanged);
    Panel1->Connect(wxEVT_PAINT,(wxObjectEventFunction)&CMI_Lab_de_RedesFrame::OnPanel1Paint,0,this);
    Connect(wxID_ANY,wxEVT_CLOSE_WINDOW,(wxObjectEventFunction)&CMI_Lab_de_RedesFrame::OnClose1);
    //*)
}

CMI_Lab_de_RedesFrame::~CMI_Lab_de_RedesFrame()
{
    //(*Destroy(CMI_Lab_de_RedesFrame)
    //*)
}

void CMI_Lab_de_RedesFrame::OnQuit(wxCommandEvent& event)
{
    Close();
}

void CMI_Lab_de_RedesFrame::OnAbout(wxCommandEvent& event)
{
    wxString msg = wxbuildinfo(long_f);
    wxMessageBox(msg, _("Welcome to..."));
}
